package com.utils;

import android.app.Application;
import android.content.Context;

import androidx.core.content.FileProvider;

import com.tencent.mmkv.MMKV;
import com.utils.toast.ToastUtils;

/**
 * @describe
 * @author: lixiaopeng
 * @Date: 2019-05-22
 */
public final class Utils {

    private static Context context;
    private static boolean isDebug = false;
    public static String TAG = "AppExp";

    /**
     * 权限请求时使用的请求码
     * code when request permission
     */
    private static int CODE_PERMISSION_REQUEST = 111;

    public static void init(Application application, boolean isDebug) {
        Utils.context = application;
        Utils.isDebug = isDebug;
        LogUtils.init(isDebug);
        ActivityUtils.init(application);
        ToastUtils.INSTANCE.initToast(application);
    }

    public static Context getApp() {
        return context;
    }

    public static boolean isDebug() {
        return isDebug;
    }

    public static void setPermissionRequestCode(int code) {
        CODE_PERMISSION_REQUEST = code;
    }

    public static int getPermissionRequestCode() {
        return CODE_PERMISSION_REQUEST;
    }

    public static void onTerminate(){
        SPUtils.INSTANCE.onTerminate();
        context = null;
    }

    public static void onLowMemory() {
    }

    public static void onTrimMemory(int level) {
    }
}
